package project_package;

import java.util.Calendar;

public class Customer extends Person
{
	double discount;
	boolean isBusiness;
		
	public Customer(int id, String name, String phoneNo, String address, long civilNum, double discount, boolean isBusiness)
	{
	    super(id, name, phoneNo, address, civilNum);
		this.discount = discount;
		this.isBusiness = isBusiness;
	}
	
	public double getDiscount() 
	{
		return discount;
	}
	
	public boolean getIsBusiness() 
	{
		return isBusiness;
	}
	
	public void setDiscount(double discount)
	{
		this.discount = discount;
	}
	
	public void setIsBusiness(boolean isBusiness) 
	{
		this.isBusiness = isBusiness;
	}
	
	public void printCustomerInfo()
	{
		Calendar memberSince = Calendar.getInstance();
		memberSince.setTimeInMillis(super.getDatestamp()*1000);
		String since = memberSince.get(Calendar.DAY_OF_MONTH)+"."+memberSince.get(Calendar.MONTH)+"."+memberSince.get(Calendar.YEAR)+" "+memberSince.get(Calendar.HOUR_OF_DAY)+":"+memberSince.get(Calendar.MINUTE);

		System.out.println("Customer ID: " + super.getID());
		System.out.println("Customer " + (isBusiness ? "CVR" : "CPR") + ":" + super.getCivilNum());
		System.out.println("Customer Name: " + super.getName());
		System.out.println("Customer Address: " + super.getAddress());
		System.out.println("Customer PhoneNo: " + super.getPhoneNo());
		System.out.println("Customer Discount: " + discount*100 + "%");
		System.out.println("Customer Type: " + (isBusiness ? "Business" : "Normal"));
		System.out.println("Customer Since: " + since);
	}
}